<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
    <!--{include file='comm/header.tpl'}-->
    <title>发布详情</title>

</head>

<style>
    .sql tr td{ border:1px dotted #CCCCCC;padding-left:10px;padding-right: 10px; }
    .sql tr th{ border:1px dotted #CCCCCC; border-bottom:none;}

</style>

<body>

<div style="width:100%">

    <div class="title">
        <h2 class="tac">
            <!--{$base.seqno}--> - 发布详情
        </h2>
    </div>

    <!--基本信息-->
    <div class="items clearfix">
        <h2 class="tal">
            基本信息
        </h2>
        <div class="items2" style="position: relative;">

            <table style="font-size:12px;" cellpadding="0" cellspacing="0">

                <tr>
                    <td style="text-align:right;padding-right:5px;width: 10%;">序号:</td>
                    <td style="width:40%;"><!--{$base.seqno}--></td>
                    <td style="text-align:right;padding-right:5px;width: 10%;">项目:</td>
                    <td style="width:40%;"><!--{$base.projectName}--></td>
                </tr>

                <tr>
                    <td style="text-align:right;padding-right:5px;" >创建时间:</td>
                    <td colspan="3"><!--{$base.createTime}--></td>
                </tr>

                <tr>
                    <td style="text-align:right;padding-right:5px;" valign="top">备注:</td>
                    <td colspan="3">
                        <textarea style="width: 98%;height: 70px;"><!--{$base.memo}--></textarea>
                    </td>
                </tr>

            </table>

        </div>
    </div>

    <!--执行的SQL-->
    <div class="items clearfix">
        <h2 class="tal">
            执行的SQL
        </h2>
        <div class="items2" style="position: relative;">

            <table style="font-size:12px;width: 100%;" cellpadding="0" cellspacing="0">

                <tr>
                    <td style="width: 5%;text-align: right;padding-right: 10px;">SQL:</td>
                    <td>
                        <textarea style="width: 98%;height: 250px;"><!--{$base.sqltxt}--></textarea>
                    </td>
                </tr>

            </table>

        </div>
    </div>

    <!--项目库SQL执行情况-->
    <div class="items clearfix">
        <h2 class="tal">
            项目库SQL执行情况
        </h2>
        <div class="items2" style="position: relative;">

            <table class="sql" style="font-size:12px;" cellpadding="0" cellspacing="0">
                <thead>
                <tr style="background-color:#EAEAEA; text-align:center;">
                    <th style="border-right:none;width: 20%;">项目库</th>
                    <th style="border-right:none;width:65%;">SQL执行结果信息</th>
                    <th style="border-right:none;width:10%;">执行状态</th>
                    <th style="border-right:none;width:5%;">操作</th>
                </tr>
                </thead>
                <tbody>

                <!--{foreach from=$detail item=line}-->
                <tr>
                    <td style="text-align: left;padding-left: 10px;"><!--{$line.dbname}--></td>
                    <td style="text-align: left;padding-left: 10px;overflow: hidden;" title="<!--{$line.msgtext}-->" ><!--{$line.msgtext}--></td>
                    <td style="text-align: center;padding-left: 10px;">
                        <!--{if $line.flg == 0}-->
                            未执行
                        <!--{else}-->
                            已执行
                        <!--{/if}-->
                    </td>
                    <td style="text-align: center;">

                        <!--{if $line.flg == 0}-->
                            <input type="button" class="btn" value="执行" onclick="sqlObj.confirmSql(<!--{$line.seqno}-->,<!--{$line.dbID}-->)">
                        <!--{/if}-->

                    </td>
                </tr>
                <!--{/foreach}-->
                </tbody>
            </table>

        </div>
    </div>



</div>





<script type="text/javascript">

    var sqlObj = {

        seqno:"",

        dbID:"",

        //往单个数据库执行SQL
        confirmSql:function( seqno , dbID ){

            this.seqno = seqno;
            this.dbID  = dbID;

            E.confirm('确认执行吗' , "sqlObj.execute");
        },

        //执行SQL
        execute:function(){
            jquery_ajax(4 , {seqno:this.seqno,dbID:this.dbID} , sqlObj.callback );
        },

        //回调函数
        callback: function( obj ) {

            if( obj.code == 200 ){
                E.alert( obj.message , 2 , 'E.refresh');
            }else{
                E.alert(obj.message);
            }

        }

    }

    function jquery_ajax(flg,data,func){
        $.ajax({
            type: "post",
            url: "/invokingAjax-backend/project/projectSql.ajax?operFlg="+flg,
            dataType: "json",
            data: data,
            success: function( result_obj ) {
                func(result_obj);
            },
            error : function(msg){
                alert('网络不给力，请重新尝试...');
            }
        });
    }

</script>


</body>
</html>